<?php
class Qtpl{
	static function assign($parames=array()){
		$_tpl = array();
		foreach ($parames as $key => $val) {
			if ($key != '') {
				$_tpl[$key] = $val;
			}
		}
		return $_tpl;
	}
	
	/**
	 * 创建url
	 * @param string $ac 控制器名称
	 * @param string $do 方法名称
	 * @param array $params get参数
	 * @param string $domain 由常量控制
	 * @return string
	 */
	static function createUrl($ac, $do, $params = array(), $domain=''){
		switch ($domain){
			case 'home':
				$url = core_lib_constant::HOME_URL;
				break;
			default:
				$url = core_lib_constant::MAIN_URL;
				break;
		}
		if(core_lib_constant::REWRITE){
			$url .= "/{$ac}/{$do}.html";
			$qstr = '?';
		}else{
			$url .= "?ac={$ac}&do={$do}";
			$qstr = '&';
		}
		if($params){
			foreach ($params as $k=>$v){
				$qstr .= "{$k}={$v}&";
			}
			$qstr = rtrim($qstr,'&');
			$url = $url.$qstr;
		}
		return $url;
	}
}